Skip to content

M5:远程版、上传与导入导出(含全仓库审查重构与依赖更新) - #11

Merged
chialecode merged 1 commit into
mainfrom
codex/m5-remote
Nov 21, 2026
Merged

chialecode merged 1 commit into
mainfrom
codex/m5-remote

Conversation

@chialecode

@chialecode chialecode commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

概述

M5 远程版、内置上传、媒体库导入导出、全仓库代码审查重构、依赖更新、无用代码/文档清理及 2026-11-21 开发版下载/媒体库归属/任务卡片问题修复(单阶段单 DCO 提交)。

主要改动

  • M5 远程版、上传与导入导出(DEC-062,FR-REMOTE-001~008,AC-56~64)
    • 无界面 cmd/trace-server(Linux amd64/arm64,CGO_ENABLED=0,不链接界面/播放器/外壳):init/run/token/version/upload-test/rclone-filter、TLS 1.3 自签名指纹固定 HTTPS + 令牌哈希鉴权 + 失败限流、Linux AES-GCM 凭证、内置 rclone 逐条目上传与确认后删除、所有未完成临时文件统一 *.part / .trace-*。
    • 桌面端:设置 › 远程、媒体库六分类扫描与增量导入/导出、任务 › 导入导出、订阅文件导出/预览导入、双节点直播段合并。
    • 工具链:tools/package -server、tools/smoke -server、双 GOOS 依赖边界与 Linux 交叉编译检查、CI 运行 Linux 远程冒烟。
  • 2026-11-20 实机反馈(DEC-063)
    • 修复抖音开播录制重入死锁、抖音共创作品按目标账号归属、图文配乐回退与公网 HTTPS 跳转、主页订阅名、全部缓存补全未完成条目。
  • 2026-11-21 全仓库代码审查、重构与清理
    • 安全与隔离:OSDesktop.OpenExternalURL 协议限制、GuardedMediaDialer 接入两站媒体传输、抖音图片/头像登录校验、凭证与签名 URL 脱敏、NTFS 联接点防护、actcheck/sitecheck 严格默认拒绝。
    • 数据安全与管线:subscription.Delete、SQLite 损坏恢复、远程 SetAllowMovedFiles、upload --files-from-raw、多节点直播合并、FLV PacketTypeMetadata = 4 与 GOP/时间线修复、Media Foundation 实时预览 COM/NV12/采样率修复、PauseAllActiveWork 按站点隔离(LOOP-016)。
    • 依赖更新(DEC-048):并入 Dependabot PR chore(deps): bump golang.org/x/image from 0.47.0 to 0.48.0 in the minor-and-patch group #9(golang.org/x/image v0.48.0),升级 mp4ff 至 v0.63.0(tools/deps due: 0,tools/deps -audit called: 0, open: 0)。
    • 清理:移除零调用 OPML 子系统与 4 个未使用函数、整理遗留测试文件名与过时文档/注释(LOOP-007)。
  • 2026-11-21 开发版下载、媒体库归属与任务卡片修复
    • 抖音配乐 blocked:将 bytednsdoc.com 加入 DefaultDouyinMediaHosts()(HTTPS 443 + GuardedMediaDialer + 零 Cookie)。
    • 抖音 need_set_token=true 图文视频页/实况 HTTP 403:透传 NeedSetToken,新增仅对 www.douyin.com/aweme/v1/play/ 发带 Cookie 且不自动跟随的 ResolvePlayRedirect,解析为无 Cookie 的 CDN 地址后再拉流(CDN 零 Cookie),普通作品直链持续 403/404 时亦支持回退。
    • B 站 code=4101152 与 DYNAMIC_TYPE_LIVE_RCMD:4101152 映射为 ErrKindUnavailable(“动态不可见或已删除”),动态缓存队列跳过不可缓存的 DYNAMIC_TYPE_LIVE_RCMD。
    • B 站转发动态附带视频归属:library 的 Statistics/ListItems/LatestPubByAuthor/CountCachedWorks 将 via.reason="forward" 归入转发者名下,不再因转发缓存为原上传者生成多余媒体库作者项。
    • 抖音共创作品详情页入口:openDouyinWorkFor 与 douyinCacheFor 保留从用户页点入详情页后的 ForUID/ForName 上下文。
    • 任务卡片布局与部分完成原因:修复任务卡片长标题挤出右侧进度百分比与进度条(补 Shrink(1)),保留并自动回填旧 partial 任务的缺失摘要,使用黄色进度条与提醒条区分 partial。

验证

  • go run ./tools/check:ALL CHECKS PASSED(全仓测试、双平台依赖方向检查、Linux amd64/arm64 远程构建与 vet、tools/checkdocs、git diff --check HEAD)。
  • go run ./tools/uishots -out artifacts/uishots:192/192 截图与全部断言通过(0 横向溢出)。
  • 有界真实站点临时验证(internal/sitecheck 账本,隔离临时目录验证后清理):3 条抖音图文(bytednsdoc.com 配乐、need_set_token=true 混排视频页与 3 页实况照片)全部一次完成(complete、0 Cookie 泄露,7 次 API、20 次媒体请求)。
  • 本机 TRACE Dev 已更新至 0.1.3-dev.202611210624(基点 bdff0ea62183),tools/package -server、tools/smoke 与 tools/smoke -server 均 PASSED。
  • 仍为 not-run:go test -race(本机无 CGO/gcc)、桌面实机体验(H-001/H-002)及真实 VPS/Google Drive 实机检查(H-003)。

…full-codebase audit

Stage TRACE-M5-01 (DEC-062, FR-REMOTE-001..008, AC-56..64):
- trace-server (cmd/trace-server, CGO off, no UI packages) runs on
  Linux VPS: init/run/token/version/upload-test/rclone-filter; HTTPS
  with a self-signed certificate pinned by the connection code, token
  hash, failure limiting, body limit and protocol handshake; no
  renewal and no full cache on the remote; SIGTERM pauses and
  finalizes recordings.
- Built-in upload drives rclone per item: media first, item.json
  last, delete only after confirmation, error classes with backoff,
  resume from upload_files after restart.
- Every unfinished file is *.part or .trace-*; legacy in-progress
  names are adopted; items carry cachedBy from node.json; Linux
  credentials use a random key file.
- Desktop: Settings > 远程 (connect, status, sync subscriptions and
  cookies, pending-cookie retry); library import page with six-way
  scan, conflict choices and verified resumable copies; export of the
  current filter; tasks section 导入导出; subscription file export and
  import with preview; two-node live merge.
- tools: package -server (linux amd64/arm64 tar.gz + SHA256SUMS),
  smoke -server with a fake rclone, check dual-GOOS dependency rules
  and cross builds, six new uishots scenes; CI runs the remote smoke.
- Dependencies (DEC-048): mp4ff v0.63.0, mygo v0.9.0, x/image v0.48.0
  (folds PR #9), x/text v0.44.0. tools/deps -audit passes with 0 called
  vulnerabilities. Removes stray package.exe.

Dev feedback 2026-11-20 (DEC-063): fix Douyin live start re-entry
self-deadlock; store Douyin co-creations under the account they were
cached for (via collab, download_tasks.via_json); fall back to a
note's top-level play_addr for music and allow public HTTPS redirects
for music downloads; show the subscription name on Home posts; let
cache queues re-cache incomplete items and count Douyin co-creations
under the member.

Full-codebase audit, bugfix, cleanup and refactor (2026-11-21):
- Security and isolation: harden OSDesktop.OpenExternalURL to http/https,
  wire GuardedMediaDialer into Bilibili/Douyin media transports and fix
  proxy-allowlist/IP-blocklist gaps, enforce per-site login in Douyin
  image/avatar fetches, mask and clear remote connection codes/tokens,
  redact signed URLs/tokens in SiteError/RoomState/logs/sitecheck,
  reject Windows NTFS junctions (ModeIrregular) and strict link checks
  on writes/deletes, enforce fail-closed actcheck/sitecheck category
  limits, and bound smoke/uishots output cleanup to artifacts/.
- Data safety and core pipelines: fix subscription Delete non-numeric
  miss wiping Douyin subscriptions, sub_id unlink/move collisions,
  OpenSQLite corruption-only recovery and WAL schema guard, remote
  allow-moved-files mode in library.Store, upload --files-from-raw write
  error check and busy/corrupt CPU spins, MergeItemMetadata live segment
  ordering/dedup/supplement merges, download staging/status-poisoning/
  context-cancel/64-bit elst fixes, live FLV PacketTypeMetadata=4/GOP/
  cover write-order/moved-dir/re-entrant stop/data-race fixes, and
  Media Foundation COM teardown UAF/pendingReads/cancel-deadlock/
  splitDecoder SampleRate-Channels/NV12 odd-dimension fixes.
- Service, shell and UI: release mutexes before event publishing, run
  cleanup on mygo.App.OnQuit before auto-update Relaunch, isolate
  PauseAllActiveWork per site (LOOP-016), serialize tray updates, fix
  remote 30s refresh busy-spin, MediaDecoder disposal on close-to-tray,
  coverless video tile mp4 reads, per-frame SQLite/disk/alloc hotspots,
  IME/modal/narrow-width bugs, and update.Controller busy-handoff race.
- Cleanup and maintainability: decompose oversized files across
  download, live, library, subscription, service, shell, ui, and tools;
  consolidate shared idle readers, URL sanitizers, dialog/avatar
  helpers, and build checksums; remove unused OPML subsystem, dead
  helpers, legacy feedback test names, stale README/docs versions, and
  legacy stage/issue comments (LOOP-007).

Dev feedback 2026-11-21 (downloads, library attribution, task UI):
- Allow bytednsdoc.com in Douyin media host allowlist for fallback note
  music (HTTPS 443, GuardedMediaDialer, 0 Cookie).
- Propagate need_set_token/is_need_set_cookie on Douyin streams and add
  authenticated no-redirect ResolvePlayRedirect on www.douyin.com
  (/aweme/v1/play/) resolving into cookieless CDN URLs (0 Cookie on CDN)
  for need_set_token note video/live-photo clips and 403 fallback.
- Map Bilibili code=4101152 to ErrKindUnavailable and skip ephemeral
  DYNAMIC_TYPE_LIVE_RCMD items in dynamic cache queues.
- Attribute Bilibili forwarded videos (via.reason="forward") to the
  forwarder in library Statistics/ListItems/LatestPubByAuthor/CountCachedWorks
  so original uploaders do not appear as phantom library authors.
- Preserve user-page forUID/forName context when opening a Douyin
  co-creation into douyin_work_view and caching from the detail view.
- Fix right-edge clipping on download task cards (Shrink(1)), preserve
  and backfill partial missing reasons, and style partial bars/banners.

Verification: go run ./tools/check (all tested packages, dual-GOOS dep
check, Linux amd64/arm64 trace-server build & vet, checkdocs),
tools/deps -audit (0 called), tools/uishots (192/192 pass), bounded
real-site verification of 3 Douyin notes (complete, 0 cookie leaks),
tools/package -install (0.1.3-dev.202611210624) & -server, desktop
smoke & server smoke pass. go test -race (no cgo/gcc on host) and
H-001/H-002/H-003 remain not-run.

Report: docs/delivery/stage-report.md.
Signed-off-by: chialecode <315431287+chialecode@users.noreply.github.com>
@chialecode
chialecode merged commit 4b37fc5 into main Nov 21, 2026
3 checks passed
@chialecode
chialecode deleted the codex/m5-remote branch November 21, 2026 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant